### The Group-Basis of Political Behavior Among Minoritized Communities:
#The Case of LGBTQ+ Linked Fate and Sexual and Gender Minorities#

#The British Journal of Political Science#

#Authors: Nathan Kar Ming Chan and Gabriele Magni#

### CMPS 2020 ### 
#load packages

library(haven)
library(effects)
library(questionr)
library(haven)
library(ggeffects)
library(sjPlot)
library(haven)
library(questionr)
library(stargazer)
library(Matching)
library(rbounds)
library(mice)
library(openxlsx)
library(rio)
library(readxl)
library(MatchIt)
library(MASS)
library(ggplot2)
library(ggpubr)
library(ggthemes)
library(readxl)

#load data

###RECODE VARIABLES##

#sexual orientation
cmps$lgbtq_crosstab <- NA
cmps$lgbtq_crosstab <- as.numeric(cmps$lgbtq_crosstab)
cmps$lgbtq_crosstab[cmps$S3==1] <- "Straight"
cmps$lgbtq_crosstab[cmps$S3==2] <- "Gay or Lesbian"
cmps$lgbtq_crosstab[cmps$S3==3] <- "Bisexual"
cmps$lgbtq_crosstab[cmps$S3==4] <- "Something else"
cmps$lgbtq_crosstab[cmps$S3==88] <- "Refused"
cmps$lgbtq_crosstab[cmps$S3==99] <- "Don't Know"
table(cmps$lgbtq_crosstab)

table(cmps$S3)
cmps$so.straight <- NA
cmps$so.straight <- as.numeric(cmps$so.straight)
cmps$so.straight <- ifelse(cmps$S3==1,1,0)

table(cmps$S3)
cmps$so.gayles <- NA
cmps$so.gayles <- as.numeric(cmps$so.gayles)
cmps$so.gayles <- ifelse(cmps$S3==2,1,0)
table(cmps$so.gayles)

cmps$so.bi <- NA
cmps$so.bi <- as.numeric(cmps$so.bi)
cmps$so.bi <- ifelse(cmps$S3==3,1,0)
table(cmps$so.bi)

cmps$so.other <- NA
cmps$so.other <- as.numeric(cmps$so.other)
cmps$so.other <- ifelse(cmps$S3==4,1,0)

cmps$so.refused <- NA
cmps$so.refused <- as.numeric(cmps$so.refused)
cmps$so.refused <- ifelse(cmps$S3==88|cmps$S3==99,1,0)
table(cmps$so.refused)

#recoding race variables
table(cmps$S2_Racer4)
cmps$asian <- NA
cmps$asian <- as.numeric(cmps$asian)
cmps$asian <- ifelse(cmps$S2_Racer4==1,1,0)
table(cmps$asian)

#white
table(cmps$S2_Racer1)
cmps$white <- NA
cmps$white <- as.numeric(cmps$white)
cmps$white <- ifelse(cmps$S2_Racer1==1,1,0)
table(cmps$white)

#latino
table(cmps$S2_Racer2)
cmps$latino <- NA
cmps$latino <- as.numeric(cmps$latino)
cmps$latino <- ifelse(cmps$S2_Racer2==1,1,0)
table(cmps$latino)

#black
table(cmps$S2_Racer3)
cmps$black <- NA
cmps$black <- as.numeric(cmps$black)
cmps$black <- ifelse(cmps$S2_Racer3==1,1,0)
table(cmps$black)

#native
table(cmps$S2_Racer5)
cmps$native <- NA
cmps$native <- as.numeric(cmps$native)
cmps$native <- ifelse(cmps$S2_Racer5==1,1,0)
table(cmps$native)

#middle eastern
cmps$me <- NA
cmps$me <- as.numeric(cmps$me)
cmps$me <- ifelse(cmps$S2_Racer6==1,1,0)
table(cmps$me)

#hawaiian
table(cmps$S2_Racer7)
cmps$hawaiian <- NA
cmps$hawaiian <- as.numeric(cmps$hawaiian)
cmps$hawaiian <- ifelse(cmps$S2_Racer7==1,1,0)
table(cmps$hawaiian)

#pacific islander
table(cmps$S2_Racer8)
cmps$pacificislander <- NA
cmps$pacificislander <- as.numeric(cmps$pacificislander)
cmps$pacificislander <- ifelse(cmps$S2_Racer8==1,1,0)
table(cmps$pacificislander)

#recoding gender
table(cmps$S3b)
cmps$gender <- NA
cmps$gender <- as.character(cmps$gender)
cmps$gender[cmps$S3b==1] <- "1. Man"
cmps$gender[cmps$S3b==2] <- "2. Woman"
cmps$gender[cmps$S3b==3] <- "3. Non-Binary"
cmps$gender[cmps$S3b==4] <- "4. Something else"
addmargins(table(cmps$gender))

#woman
table(cmps$S3b)
cmps$woman <- NA
cmps$woman <- as.numeric(cmps$woman)
cmps$woman <- ifelse(cmps$S3b==2,1,0)
table(cmps$woman)

#man
table(cmps$S3b)
cmps$man <- NA
cmps$man <- as.numeric(cmps$man)
cmps$man <- ifelse(cmps$S3b==1,1,0)
table(cmps$man)

#nonbinary
table(cmps$S3b)
cmps$nonbinary <- NA
cmps$nonbinary <- as.numeric(cmps$nonbinary)
cmps$nonbinary <- ifelse(cmps$S3b==3,1,0)
table(cmps$nonbinary)

#other gender
cmps$gender.other <- NA
cmps$gender.other <- as.numeric(cmps$gender.other)
cmps$gender.other <- ifelse(cmps$S3b==4,1,0)
table(cmps$gender.other)

#age
table(cmps$S5_Age)
cmps$age <- NA
cmps$age <- as.numeric(cmps$age)
cmps$age[cmps$S5_Age==2] <- 0
cmps$age[cmps$S5_Age==3] <- 0.2
cmps$age[cmps$S5_Age==4] <- 0.4
cmps$age[cmps$S5_Age==5] <- 0.6
cmps$age[cmps$S5_Age==6] <- 0.8
cmps$age[cmps$S5_Age==7] <- 1
table(cmps$age)

#education
table(cmps$S13)
cmps$education <- NA
cmps$education <- as.numeric(cmps$education)
cmps$education[cmps$S13==1] <- 0
cmps$education[cmps$S13==2] <- 0.167
cmps$education[cmps$S13==3] <- 0.333
cmps$education[cmps$S13==4] <- 0.5
cmps$education[cmps$S13==5] <- 0.667
cmps$education[cmps$S13==6] <- 0.833
cmps$education[cmps$S13==7] <- 1
table(cmps$education)

#income
table(cmps$Q813)
cmps$income <- NA
cmps$income <- as.numeric(cmps$income)
cmps$income[cmps$Q813==1] <- 0
cmps$income[cmps$Q813==2] <- 0.091
cmps$income[cmps$Q813==3] <- 0.182
cmps$income[cmps$Q813==4] <- 0.273
cmps$income[cmps$Q813==5] <- 0.364
cmps$income[cmps$Q813==6] <- 0.455
cmps$income[cmps$Q813==7] <- 0.545
cmps$income[cmps$Q813==8] <- 0.636
cmps$income[cmps$Q813==9] <- 0.727
cmps$income[cmps$Q813==10] <- 0.818
cmps$income[cmps$Q813==11] <- 0.909
cmps$income[cmps$Q813==12] <- 1
cmps$income[cmps$Q813==99] <- NA
table(cmps$income)  

#religious attendance
cmps$religious.attendance <- NA
cmps$religious.attendance <- as.numeric(cmps$religious.attendance)
cmps$religious.attendance[cmps$Q59==1] <- 1
cmps$religious.attendance[cmps$Q59==2] <- 0.8
cmps$religious.attendance[cmps$Q59==3] <- 0.6
cmps$religious.attendance[cmps$Q59==4] <- 0.4
cmps$religious.attendance[cmps$Q59==5] <- 0.2
cmps$religious.attendance[cmps$Q59==6] <- 0
table(cmps$religious.attendance)

#democratic party strength
cmps$democratpartystrength <- NA
cmps$democratpartystrength <- as.numeric(cmps$democratpartystrength)
cmps$democratpartystrength[cmps$Q21==1&cmps$Q22==1] <- 1 #strong rep
cmps$democratpartystrength[cmps$Q21==2&cmps$Q22==1] <- 1.6 #strong dem
cmps$democratpartystrength[cmps$Q21==1&cmps$Q22==2] <- 0.125 #weak rep
cmps$democratpartystrength[cmps$Q21==2&cmps$Q22==2] <- 0.875 #weak dem
cmps$democratpartystrength[cmps$Q21==3&cmps$Q23==1] <- 0.25 #lean rep
cmps$democratpartystrength[cmps$Q21==3&cmps$Q23==2] <- 0.75 #lean dem
cmps$democratpartystrength[cmps$Q21==4&cmps$Q23==1] <- 0.375 #other rep
cmps$democratpartystrength[cmps$Q21==4&cmps$Q23==2] <- 0.625 #other dem
cmps$democratpartystrength[cmps$Q21==3&cmps$Q23==3] <- 0.5 #pure independent
table(cmps$democratpartystrength)

cmps$democrat <- NA
cmps$democrat <- as.numeric(cmps$democrat)
cmps$democrat[cmps$Q21==1&cmps$Q22==1] <- 0 #strong rep
cmps$democrat[cmps$Q21==2&cmps$Q22==1] <- 1 #strong dem
cmps$democrat[cmps$Q21==1&cmps$Q22==2] <- 0 #weak rep
cmps$democrat[cmps$Q21==2&cmps$Q22==2] <- 1 #weak dem
cmps$democrat[cmps$Q21==3&cmps$Q23==1] <- 0 #lean rep
cmps$democrat[cmps$Q21==3&cmps$Q23==2] <- 1 #lean dem
cmps$democrat[cmps$Q21==4&cmps$Q23==1] <- 0 #other rep
cmps$democrat[cmps$Q21==4&cmps$Q23==2] <- 1 #other dem
cmps$democrat[cmps$Q21==3&cmps$Q23==3] <- 0 #pure independent
table(cmps$democrat)

cmps$republican <- NA
cmps$republican <- as.numeric(cmps$republican)
cmps$republican[cmps$Q21==1&cmps$Q22==1] <- 1 #strong rep
cmps$republican[cmps$Q21==2&cmps$Q22==1] <- 0 #strong dem
cmps$republican[cmps$Q21==3&cmps$Q23==1] <- 1 #lean rep
cmps$republican[cmps$Q21==3&cmps$Q23==2] <- 0 #lean dem
cmps$republican[cmps$Q21==4&cmps$Q23==1] <- 1 #other rep
cmps$republican[cmps$Q21==4&cmps$Q23==2] <- 0 #other dem
cmps$republican[cmps$Q21==1&cmps$Q22==2] <- 1 #weak rep
cmps$republican[cmps$Q21==2&cmps$Q22==2] <- 0 #weak dem
cmps$republican[cmps$Q21==3&cmps$Q23==3] <- 0 #pure independent
table(cmps$republican)

cmps$independent <- NA
cmps$independent <- as.numeric(cmps$independent)
cmps$independent[cmps$Q21==1&cmps$Q22==1] <- 0 #strong rep
cmps$independent[cmps$Q21==2&cmps$Q22==1] <- 0 #strong dem
cmps$independent[cmps$Q21==3&cmps$Q23==1] <- 0 #lean rep
cmps$independent[cmps$Q21==3&cmps$Q23==2] <- 0 #lean dem
cmps$independent[cmps$Q21==4&cmps$Q23==1] <- 0 #other rep
cmps$independent[cmps$Q21==4&cmps$Q23==2] <- 0 #other dem
cmps$independent[cmps$Q21==1&cmps$Q22==2] <- 0 #weak rep
cmps$independent[cmps$Q21==2&cmps$Q22==2] <- 0 #weak dem
cmps$independent[cmps$Q21==3&cmps$Q23==3] <- 1 #pure independent
table(cmps$independent)

#strength of partisanship
cmps$partystrength <- NA
cmps$partystrength <- as.numeric(cmps$partystrength)
cmps$partystrength[cmps$Q21==1&cmps$Q22==1] <- 1 #strong rep
cmps$partystrength[cmps$Q21==2&cmps$Q22==1] <- 1  #strong dem
cmps$partystrength[cmps$Q21==3&cmps$Q23==1] <- 0.5 #lean rep
cmps$partystrength[cmps$Q21==3&cmps$Q23==2] <- 0.5   #lean dem
cmps$partystrength[cmps$Q21==4&cmps$Q23==1] <- 0.25 #other rep
cmps$partystrength[cmps$Q21==4&cmps$Q23==2] <- 0.25  #other dem
cmps$partystrength[cmps$Q21==1&cmps$Q22==2] <- 0.75  #weak rep
cmps$partystrength[cmps$Q21==2&cmps$Q22==2] <- 0.75  #weak dem
cmps$partystrength[cmps$Q21==3&cmps$Q23==3] <- 0 #pure independent
table(cmps$partystrength)

#interest in politics
table(cmps$Q29)
cmps$interest <- NA
cmps$interest <- as.numeric(cmps$interest)
cmps$interest[cmps$Q29==1] <- 1
cmps$interest[cmps$Q29==2] <- 0.667
cmps$interest[cmps$Q29==3] <- 0.333
cmps$interest[cmps$Q29==4] <- 0
table(cmps$interest)

#recruited or asked to vote
table(cmps$Q38r4)
cmps$recruitment <- NA
cmps$recruitment <- as.numeric(cmps$recruitment)
cmps$recruitment <- ifelse(cmps$Q38r4==0,1,0)
table(cmps$recruitment)

#liberal
cmps$liberalstrength <- NA
cmps$liberalstrength <- as.numeric(cmps$liberalstrength)
cmps$liberalstrength[cmps$Q43==1] <- 1
cmps$liberalstrength[cmps$Q43==2] <- 0.75
cmps$liberalstrength[cmps$Q43==3] <- 0.5
cmps$liberalstrength[cmps$Q43==4] <- 0.25
cmps$liberalstrength[cmps$Q43==5] <- 0
cmps$liberalstrength[cmps$Q43==6] <- NA
table(cmps$liberalstrength)

cmps$ideology <- NA
cmps$ideology <- as.numeric(cmps$ideology)
cmps$ideology[cmps$Q43==1] <- 1
cmps$ideology[cmps$Q43==2] <- 0.75
cmps$ideology[cmps$Q43==3] <- 0.5
cmps$ideology[cmps$Q43==4] <- 0.25
cmps$ideology[cmps$Q43==5] <- 0
cmps$ideology[cmps$Q43==6] <- NA
table(cmps$ideology)

#racial resentment
table(cmps$Q213r1)
cmps$rr1_irish <- NA
cmps$rr1_irish <- as.numeric(cmps$rr1_irish)
cmps$rr1_irish[cmps$Q213r1==1] <- 1
cmps$rr1_irish[cmps$Q213r1==2] <- 0.75 
cmps$rr1_irish[cmps$Q213r1==3] <- 0.5
cmps$rr1_irish[cmps$Q213r1==4] <- 0.25
cmps$rr1_irish[cmps$Q213r1==5] <- 0
table(cmps$rr1_irish) 

table(cmps$Q213r2)
cmps$rr2_generations <- NA
cmps$rr2_generations <- as.numeric(cmps$rr2_generations)
cmps$rr2_generations[cmps$Q213r1==1] <- 0
cmps$rr2_generations[cmps$Q213r1==2] <- 0.25 
cmps$rr2_generations[cmps$Q213r1==3] <- 0.5
cmps$rr2_generations[cmps$Q213r1==4] <- 0.75
cmps$rr2_generations[cmps$Q213r1==5] <- 1
table(cmps$rr2_generations) 

table(cmps$Q213r3)
cmps$rr3_deserve <- NA
cmps$rr3_deserve <- as.numeric(cmps$rr3_deserve)
cmps$rr3_deserve[cmps$Q213r3==1] <- 0
cmps$rr3_deserve[cmps$Q213r3==2] <- 0.25 
cmps$rr3_deserve[cmps$Q213r3==3] <- 0.5
cmps$rr3_deserve[cmps$Q213r3==4] <- 0.75
cmps$rr3_deserve[cmps$Q213r3==5] <- 1
table(cmps$rr3_deserve) 

table(cmps$Q213r4)
cmps$rr4_deserve <- NA
cmps$rr4_deserve <- as.numeric(cmps$rr4_deserve)
cmps$rr4_deserve[cmps$Q213r4==1] <- 1
cmps$rr4_deserve[cmps$Q213r4==2] <- 0.75 
cmps$rr4_deserve[cmps$Q213r4==3] <- 0.5
cmps$rr4_deserve[cmps$Q213r4==4] <- 0.25
cmps$rr4_deserve[cmps$Q213r4==5] <- 0
table(cmps$rr4_deserve) 

#racial resentment scaled together
cmps$rr <- NA
cmps$rr <- as.numeric(cmps$rr)
cmps$rr <- ((cmps$rr1_irish)+(cmps$rr2_generations)+(cmps$rr3_deserve)+(cmps$rr4_deserve))/4
addmargins(table(cmps$rr))

#vote choice in 2020
table(cmps$Q14)
cmps$biden <- NA
cmps$biden <- as.numeric(cmps$biden)
cmps$biden <- ifelse(cmps$Q14==2,1,0)
table(cmps$biden)

#perceived discrimination against lgbtq community
table(cmps$Q619_Q626r7)
cmps$discrimination.perceived.lgbtq <- NA
cmps$discrimination.perceived.lgbtq <- as.numeric(cmps$discrimination.perceived.lgbtq)
cmps$discrimination.perceived.lgbtq[cmps$Q619_Q626r7==1] <- 1
cmps$discrimination.perceived.lgbtq[cmps$Q619_Q626r7==2] <- 0.667
cmps$discrimination.perceived.lgbtq[cmps$Q619_Q626r7==3] <- 0.333
cmps$discrimination.perceived.lgbtq[cmps$Q619_Q626r7==4] <- 0
cmps$discrimination.perceived.lgbtq[cmps$Q619_Q626r7==5] <- NA
table(cmps$discrimination.perceived.lgbtq)

#experienced any discrimination
table(cmps$Q627)
cmps$discrimination.experienced <- NA
cmps$discrimination.experienced <- as.numeric(cmps$discrimination.experienced)
cmps$discrimination.experienced <- ifelse(cmps$Q627==1,1,0)
table(cmps$discrimination.experienced)

#experienced any discriminaton because of sexuality or sexual orientation
table(cmps$Q629r4) #1=because of sexuality or sexual orientation discrimination
cmps$discrimination.experienced.sexual.orientation <- NA
cmps$discrimination.experienced.sexual.orientation <- as.numeric(cmps$discrimination.experienced.sexual.orientation) 
cmps$discrimination.experienced.sexual.orientation[cmps$discrimination.experienced==0] <- 0
cmps$discrimination.experienced.sexual.orientation[cmps$Q629r4==1] <- 1
cmps$discrimination.experienced.sexual.orientation[cmps$Q629r4==0] <- 0
table(cmps$discrimination.experienced.sexual.orientation)

#transgender identity
table(cmps$S3c)
cmps$trans_crosstab <- NA
cmps$trans_crosstab <- as.character(cmps$trans_crosstab)
cmps$trans_crosstab[cmps$S3c==1] <- "Transgender" 
cmps$trans_crosstab[cmps$S3c==2] <- "Not Transgender"
cmps$trans_crosstab[cmps$S3c==88] <- "Don't Know"
table(cmps$trans_crosstab)

cmps$trans <- NA
cmps$trans <- as.numeric(cmps$trans)
cmps$trans <- ifelse(cmps$S3c==1,1,0)
table(cmps$trans)

#came out sexuality
table(cmps$Q826r6)
cmps$cameout <- NA
cmps$cameout <- as.numeric(cmps$cameout)
cmps$cameout <- ifelse(cmps$Q826r6==0,1,0)
table(cmps$cameout)

#registered
cmps$registered <- NA
cmps$registered <- as.numeric(cmps$registered)
cmps$registered[cmps$S6==1] <- 1
cmps$registered[cmps$S6==2] <- 0
cmps$registered[cmps$S6==3] <- NA
table(cmps$registered)

#voter turnout
cmps$turnout <- NA
cmps$turnout <- as.numeric(cmps$turnout)
cmps$turnout[cmps$Q12==1] <- 1
cmps$turnout[cmps$Q12==2] <- 1
cmps$turnout[cmps$Q12==3] <- 0
cmps$turnout[cmps$Q12==4] <- 0
cmps$turnout[cmps$registered==0] <- 0
table(cmps$turnout) 

#citzenship status
cmps$citizen <- NA
cmps$citizen <- as.numeric(cmps$citizen)
cmps$citizen[cmps$S7==1] <- 1
cmps$citizen[cmps$Q807==1] <- 1
cmps$citizen[cmps$Q807==2] <- 0
cmps$citizen[cmps$Q807==3] <- 0
cmps$citizen[cmps$Q807==4] <- 0
cmps$citizen[cmps$Q807==5] <- 0
cmps$citizen[cmps$Q807==6] <- 0
cmps$citizen[cmps$Q807==7] <- 0
cmps$citizen[cmps$Q807==8] <- 0
table(cmps$Q807)
table(cmps$citizen)

#lgbtq linked fate
table(cmps$Q551_Q559r3)
cmps$lf.lgbtq <- NA
cmps$lf.lgbtq <- as.numeric(cmps$lf.lgbtq)
cmps$lf.lgbtq[cmps$Q551_Q559r3==1] <- 0
cmps$lf.lgbtq[cmps$Q551_Q559r3==2] <- 0.25
cmps$lf.lgbtq[cmps$Q551_Q559r3==3] <- 0.5
cmps$lf.lgbtq[cmps$Q551_Q559r3==4] <- 0.75
cmps$lf.lgbtq[cmps$Q551_Q559r3==5] <- 1
table(cmps$lf.lgbtq)

#lgbtq threaten vision of US
table(cmps$Q225r12)
cmps$lgbtq_threaten <- NA
cmps$lgbtq_threaten <- as.character(cmps$lgbtq_threaten)
cmps$lgbtq_threaten[cmps$Q225r12==1] <- "Supports Vision"
cmps$lgbtq_threaten[cmps$Q225r12==2] <- "Supports Vision"
cmps$lgbtq_threaten[cmps$Q225r12==3] <- "Supports Vision"
cmps$lgbtq_threaten[cmps$Q225r12==4] <- "Neither"
cmps$lgbtq_threaten[cmps$Q225r12==5] <- "Threatens"
cmps$lgbtq_threaten[cmps$Q225r12==6] <- "Threatens"
cmps$lgbtq_threaten[cmps$Q225r12==7] <- "Threatens"
table(cmps$lgbtq_threaten)

#lgbtq views on equality
table(cmps$Q192)
cmps$lgbtq_equality <- NA
cmps$lgbtq_equality <- as.character(cmps$lgbtq_equality)
cmps$lgbtq_equality[cmps$Q192==1] <- "Part of Instutions like Marriage"
cmps$lgbtq_equality[cmps$Q192==2] <- "Distinct"
table(cmps$lgbtq_equality)

#number of lgbtq friends
cmps$lgbtq_friends <- NA
cmps$lgbtq_friends <- as.numeric(cmps$lgbtq_friends)
cmps$lgbtq_friends[cmps$Q821==1] <- 0
cmps$lgbtq_friends[cmps$Q821==2] <- 0.25
cmps$lgbtq_friends[cmps$Q821==3] <- 0.5
cmps$lgbtq_friends[cmps$Q821==4] <- 0.75
cmps$lgbtq_friends[cmps$Q821==5] <- 1.0
table(cmps$lgbtq_friends)  

#Subset only the LGBTQ Sample
lgbtqs <- subset(cmps, subset=(S3==2|
                                 S3==3|
                                 S3==4|trans==1)) #1,968

#subset only LGBT citizens
lgbtq.citizen <- subset(lgbtqs, subset=(citizen==1))

#subset only LGBT citizens who voted
lgbtq.citizen.turnout <- subset(lgbtq.citizen, subset=(turnout==1))

###TABLE 1
mod1 <- lm(lf.lgbtq~so.bi+so.other+trans+
             woman+
             black+latino+asian+native+pacificislander+hawaiian+me+
             age+education+income, data=lgbtqs,
           weights=lgbtqs$os_weight)
summary(mod1)

mod2 <- lm(lf.lgbtq~so.bi+so.other+trans+
             woman+
             black+latino+asian+native+pacificislander+hawaiian+me+
             age+education+income
           +religious.attendance+interest+
             cameout+discrimination.perceived.lgbtq+discrimination.experienced.sexual.orientation+lgbtq_friends, data=lgbtqs,
           weights=lgbtqs$os_weight)
summary(mod2)

#TABLE 2
mod3 <- glm(turnout~lf.lgbtq,data=lgbtq.citizen,weights=lgbtq.citizen$os.weight,
            family='binomial')
summary(mod3)

mod4 <- glm(turnout~lf.lgbtq+
              so.bi+so.other+trans+
              woman+
              black+latino+asian+native+pacificislander+hawaiian+me+
              age+education+income+religious.attendance,data=lgbtq.citizen,weights=lgbtq.citizen$os.weight,
            family='binomial')
summary(mod4)

mod5 <- glm(turnout~lf.lgbtq+
              so.bi+so.other+trans+
              woman+
              black+latino+asian+native+pacificislander+hawaiian+me+
              age+education+income+religious.attendance+
              interest+partystrength+recruitment,data=lgbtq.citizen,weights=lgbtq.citizen$os.weight,
            family='binomial')
summary(mod5)

#TABLE 3
mod6 <- lm(ideology~lf.lgbtq,data=lgbtqs, weights=lgbtqs$os_weight)
summary(mod6) 

mod7 <- lm(ideology~lf.lgbtq+
             so.bi+so.other+trans+
             woman+
             black+latino+asian+native+pacificislander+hawaiian+me+
             age+education+income+religious.attendance,data=lgbtqs, weights=lgbtqs$os_weight)
summary(mod7) 

mod8 <- lm(ideology~lf.lgbtq+
             so.bi+so.other+trans+
             woman+
             black+latino+asian+native+pacificislander+hawaiian+me+
             age+education+income+religious.attendance
           +rr+interest+democratpartystrength,data=lgbtqs, weights=lgbtqs$os_weight)
summary(mod8)

###FIGURE 2
mod9 <- lm(democratpartystrength~lf.lgbtq,data=lgbtqs, weights=lgbtqs$os_weight)
summary(mod9)

mod10 <- lm(democratpartystrength~lf.lgbtq+
              so.bi+so.other+trans+
              woman+
              black+latino+asian+native+pacificislander+hawaiian+me+
              age+education+income+religious.attendance,data=lgbtqs, weights=lgbtqs$os_weight)
summary(mod10) 

mod11 <- lm(democratpartystrength~lf.lgbtq+
              so.bi+so.other+trans+
              woman+
              black+latino+asian+native+pacificislander+hawaiian+me+
              age+education+income+religious.attendance+
              rr+interest+ideology,data=lgbtqs, weights=lgbtqs$os_weight)
summary(mod11) 

#FIGURE 2
mod12 <- glm(biden~lf.lgbtq,data=lgbtq.citizen.turnout,weights=lgbtq.citizen.turnout$os.weight,
             family='binomial')
summary(mod12)

mod13 <- glm(biden~lf.lgbtq+
               so.bi+so.other+trans+
               woman+
               black+latino+asian+native+pacificislander+hawaiian+me+
               age+education+income+religious.attendance,data=lgbtq.citizen.turnout,weights=lgbtq.citizen.turnout$os.weight,
             family='binomial')
summary(mod13)

mod14 <- glm(biden~lf.lgbtq+
               so.bi+so.other+trans+
               woman+
               black+latino+asian+native+pacificislander+hawaiian+me+
               age+education+income+religious.attendance+
               rr+interest+democratpartystrength+ideology,data=lgbtq.citizen.turnout,weights=lgbtq.citizen.turnout$os.weight,
             family='binomial')
summary(mod14)